import Vue from 'vue';
import VueRouter from 'vue-router';
import VueMeta from 'vue-meta';

import Index from '@/views/index.vue';

import Home from './home';
import Register from './register';
import Landing from './landing';
import OtherStatic from './other_static';
const Sitemap = {
	'name': 'site_map',
	'path': '/site_map',
	'component': Index,
	'meta': {
		'title': '还卡超人'
	}
};
const Others = {
	'name': 'others',
	'path': '*',
	'meta': {
		'title': '还卡超人'
	},
	'redirect': '/'
};

Vue.use(VueRouter);
Vue.use(VueMeta);

const Router = new VueRouter({
	'mode': 'history',
	'routes': [
		Home,
		Register,
		Landing,
		...OtherStatic,
		Sitemap,
		Others
	]
});
Router.beforeEach((to, from, next) => {
	document.title = to.meta.title || '还卡超人';
	next();
});

export default Router;
